#include "EventResource.hpp"

Glib::RefPtr<Gtk::Builder>
Event::get_resource_from(const std::string &resource_path)
{
    GError *error = nullptr;
    gboolean result = false;
    auto refBuilder = Gtk::Builder::create();

    result = gtk_builder_add_from_resource(refBuilder->gobj(), resource_path.c_str(), &error);
    if (!result)
    {
        if (error)
        {
            throw std::runtime_error(error->message);
        }
        else
        {
            throw std::runtime_error("Error when get_resource_from()" + resource_path);
        }
    }
    return refBuilder;
}
